<template>
	<view class="">
		<view class="dis-count-item" v-for="(item, i) in disCountList" :key="i" @tap="isCountTap(i)">
			<image class="dis-count-img" v-if="isCountActive == i" src="../../static/img/check_fill.png" mode="">
			</image>
			<view class="dis-count-msg">
				<view class="dis-price">{{item.price}}<text class="num">元</text>
				</view>
				<view class="dis-title">
					{{item.money_off}}
				</view>
				<view class="dis-time">
					有效期：{{item.period_of_validity}}
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		name: "t-count",
		props: {
			disCountList: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				isCountActive: 0,
			};
		},
		methods: {
			isCountTap(i) {
				this.isCountActive = i
			}
		}
	}
</script>

<style lang="scss">
	.dis-count-item {
		position: relative;
		margin: 0 20rpx;
		padding-left: 45rpx;
		margin-bottom: 30rpx;

		.dis-count-msg {
			padding: 10rpx 0 0 30rpx;
			box-sizing: border-box;
			background: url('@/static/img/discount.png') no-repeat;
			background-size: contain;
			width: 656rpx;
			height: 236rpx;

			.dis-price {
				display: table-cell;
				vertical-align: bottom;
				font-weight: bold;
				font-size: 100rpx;
				color: #ffffff;

				.num {
					font-size: 28rpx;
					color: #ffffff;
				}
			}

			.dis-title {
				font-size: 29rpx;
				line-height: 30rpx;
				color: #ffffff;
			}

			.dis-time {
				font-size: 22rpx;
				color: #ffffff;
				opacity: 0.6;
			}
		}

		.dis-count-img {
			position: absolute;
			left: 0;
			top: 50%;
			transform: translateY(-50%);
			width: 30rpx;
			height: 30rpx;
		}

	}
</style>
